package com.gxa.saas.portal.mapper;

import com.gxa.saas.core.vo.UserOderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Auther: pengxtao
 * @Date: 2022/7/26下午6:49
 */
@Mapper
public interface SelectOrderMapper {
    @Select("SELECT pr.pr_name AS prName,go.color_name AS color,go.spe_name AS speName, go.pro_num AS proNum,(SELECT picture.picture_name FROM picture WHERE picture.pro_id = pr.id LIMIT 1 ) AS picture,tr.od_time AS time,tr.od_number AS oderId FROM tb_order tr,goods_order go,product pr WHERE pr.id = go.goods_id AND  go.order_id = tr.od_number AND tr.user_id=#{userId}")
    public List<UserOderVo> selectUserOrder(@Param("userId") String userId);

    @Select("SELECT pr.pr_name AS prName,go.color_name AS color,go.spe_name AS speName, go.pro_num AS proNum,(SELECT picture.picture_name FROM picture WHERE picture.pro_id = pr.id LIMIT 1 ) AS picture,tr.od_time AS time,tr.od_number AS oderId FROM tb_order tr,goods_order go,product pr WHERE pr.id = go.goods_id AND  go.order_id = tr.od_number AND tr.user_id=#{userId} AND tr.od_status=#{value}")
    public List<UserOderVo> selectStatusOrder(@Param("userId") String userId,@Param("value") Integer value);

    @Select("SELECT pr.pr_name AS prName,go.color_name AS color,go.spe_name AS speName, go.pro_num AS proNum,tr.od_time AS time,tr.od_number AS oderId,tr.sh_name AS shName, tr.sh_phone AS phone,tr.od_price AS price FROM tb_order tr,goods_order go,product pr WHERE pr.id = go.goods_id AND  go.order_id = tr.od_number AND tr.od_number= #{oderId}")
    public List<UserOderVo> selectDetailsOrder(@Param("oderId") String oderId);
}
